#ifndef __3G_CMN_H__
#define __3G_CMN_H__

#include <stdio.h>
typedef enum tag_xg_ret {
    xg_ret_ok = 0,
    xg_ret_nok,
    xg_not_found,
    xg_sms_off,
    xg_sms_on,
    xg_not_supported,
    xg_uart_read_zero,
    xg_err_uart,
    xg_err_uart_read,
    xg_err_uart_write,
    xg_err_param,

} xg_ret_t;

#define LOG_EMERG             0
#define LOG_ALERT             1
#define LOG_CRIT              2
#define LOG_ERR               3
#define LOG_WARNING           4
#define LOG_NOTICE            5
#define LOG_INFO              6
#define LOG_DEBUG             7
#define LOG_USE_GLOBAL_FILTER 8
const char *shortname(const char *filename);
void dongle_app_savelog(int32_t level, const char *filename, uint32_t line,  char *fmt, ...);
void lockThread();
void unlockThread();
bool send_qmsg(char *msg, U16 length);
#define DONGLE_LOG(level, fmt, args...) lockThread();\
dongle_app_savelog(level, shortname(__FILE__), __LINE__,  (char *)fmt, ##args);\
unlockThread();
#endif //__3G_CMN_H__
